package spring5;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author liujunjie
 * @create 2021-08-29 20:24
 */
public class Spring5Test {

    @Test
    public void testUser(){
       ApplicationContext Context = new ClassPathXmlApplicationContext("bean1.xml");

       //获取配置创建的对象
       User user = Context.getBean("user",User.class);

        System.out.println(user);
        user.add();

    }


    @Test
    public void testBooks(){
       ApplicationContext Context = new ClassPathXmlApplicationContext("bean1.xml");

       //获取配置创建的对象
      Book book = Context.getBean("book",Book.class);

        System.out.println(book);
        book.book();

    }

    @Test
    public void testOrders(){
       ApplicationContext Context = new ClassPathXmlApplicationContext("bean1.xml");

       //获取配置创建的对象
        Orders orders = Context.getBean("orders",Orders.class);

        System.out.println(orders);
        orders.ordersTest();

    }
}
